package com.dingtalk.handler;

import com.dingtalk.util.DingTalkUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class GroupMessageHandler {

    public void handleMessage(String chatId, String content, String accessToken) {
        try {
            if (content.contains("帮助")) {
                replyText(chatId, "我是机器人，可以为您服务！", accessToken);
            }
        } catch (Exception e) {
            log.error("处理消息失败", e);
        }
    }

    private void replyText(String chatId, String text, String accessToken) throws Exception {
        DingTalkUtil.sendGroupMessage(chatId, text, accessToken);
    }
} 